///*
// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
// *
// *  Redistribution and use in source and binary forms, with or without
// *  modification, are permitted provided that the following conditions are met:
// *
// *  Redistributions of source code must retain the above copyright notice,
// *  this list of conditions and the following disclaimer.
// *  Redistributions in binary form must reproduce the above copyright
// *  notice, this list of conditions and the following disclaimer in the
// *  documentation and/or other materials provided with the distribution.
// *  Neither the name of the dreamlu.net developer nor the names of its
// *  contributors may be used to endorse or promote products derived from
// *  this software without specific prior written permission.
// *  Author: Chill 庄骞 (smallchill@163.com)
// */
//package org.springblade.modules.repair.service.impl;
//
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import org.springblade.modules.repair.entity.MaintainGroup;
//import org.springblade.modules.repair.vo.MaintainGroupVO;
//import org.springblade.modules.repair.mapper.MaintainGroupMapper;
//import org.springblade.modules.repair.service.IMaintainGroupService;
//import org.springblade.core.mp.base.BaseServiceImpl;
//import org.springblade.modules.repair.vo.plan.GroupLeaderVo;
//import org.springframework.stereotype.Service;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 维保小组表 服务实现类
// *
// * @author zcc
// * @since 2021-07-28
// */
//@Service
//public class MaintainGroupServiceImpl extends BaseServiceImpl<MaintainGroupMapper, MaintainGroup> implements IMaintainGroupService {
//
//	@Override
//	public IPage<MaintainGroupVO> selectMaintainGroupPage(IPage<MaintainGroupVO> page, MaintainGroupVO maintainGroup) {
//		return page.setRecords(baseMapper.selectMaintainGroupPage(page, maintainGroup));
//	}
//
//	@Override
//	public List<Long> getChildGroupIds(Long id) {
//
//		List<MaintainGroup> groups = baseMapper.selectList(Wrappers.<MaintainGroup>lambdaQuery().eq(MaintainGroup::getParentId, id));
//		List<Long> collect = groups.stream().map(MaintainGroup::getId).collect(Collectors.toList());
//		List<Long> resultList = new ArrayList<>(20);
//		resultList.addAll(collect);
//		for (int i = 0; i < collect.size(); i++) {
//			List<Long> ids= new ArrayList<>();
//			List<Long> childGroupId = getChildGroupId(ids,collect.get(i));
//			resultList.addAll(childGroupId);
//		}
//		return resultList;
//	}
//
//	@Override
//	public List<GroupLeaderVo> getGroupLeaderInfoByGroupIds(List<Long> groupIds) {
//
//
//		return baseMapper.getGroupLeaderInfoByGroupIds(groupIds);
//	}
//
//	private List<Long> getChildGroupId(List<Long> ids,Long id){
//		List<MaintainGroup> groups = baseMapper.selectList(Wrappers.<MaintainGroup>lambdaQuery().eq(MaintainGroup::getParentId, id));
//		if(groups.size()>0){
//			List<Long> idss = groups.stream().map(MaintainGroup::getId).collect(Collectors.toList());
//			ids.addAll(idss);
//			for (int i = 0; i < idss.size(); i++) {
//				getChildGroupId(ids,idss.get(i));
//			}
//		}
//		return ids;
//	}
//}
